package com.clt.ess.gjzw.domain.revocationSealInfo;


import com.clt.ess.gjzw.domain.SignInfo;

import java.io.Serializable;
import java.util.List;

//上传电子印章撤销信息接口请求业务参数
public class RevocationSealInfoRequest implements Serializable {
    //命令编码 revocationSealInfo
    //必须
    private String taskCode;
    //协议版本号 1.0
    //必须
    private String version;
    //客户端随机数（randomA）与服务端随机数（randomB） 字符串拼接，中间无分割符号
    //必须
    private String tokenInfo;
    //业务类型编码，0 表示备案业务，1 表示保护密钥更新业务，2 表示印章撤销，3 表示申请电子印章唯一赋码业务
    //必须
    private String taskTypeCode;
    //上传电子印章撤销信息接口请求业务参数的data类
    //必须
    private List<RevocationSealInfoRequestData> data;
    //签名信息
    //必须
    private SignInfo signInfo;

    /**
     {
         "taskCode ": "revocationSealInfo ",
         "version ": "1.0",
         "tokenInfo": "randomA+randomB",
         "taskTypeCode": "2",
         "data": [{
             "yzbm": "印章编码",
             "deviceCode ": "设备编码",
             "encDeviceCode ": "base64 编码的设备编码密文"
         }]
     }
     */

    public RevocationSealInfoRequest() {
    }

    public RevocationSealInfoRequest(String taskCode, String version, String tokenInfo, String taskTypeCode, List<RevocationSealInfoRequestData> data, SignInfo signInfo) {
        this.taskCode = taskCode;
        this.version = version;
        this.tokenInfo = tokenInfo;
        this.taskTypeCode = taskTypeCode;
        this.data = data;
        this.signInfo = signInfo;
    }

    public String getTaskCode() {
        return taskCode;
    }

    public void setTaskCode(String taskCode) {
        this.taskCode = taskCode;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getTokenInfo() {
        return tokenInfo;
    }

    public void setTokenInfo(String tokenInfo) {
        this.tokenInfo = tokenInfo;
    }

    public String getTaskTypeCode() {
        return taskTypeCode;
    }

    public void setTaskTypeCode(String taskTypeCode) {
        this.taskTypeCode = taskTypeCode;
    }

    public List<RevocationSealInfoRequestData> getData() {
        return data;
    }

    public void setData(List<RevocationSealInfoRequestData> data) {
        this.data = data;
    }

    public SignInfo getSignInfo() {
        return signInfo;
    }

    public void setSignInfo(SignInfo signInfo) {
        this.signInfo = signInfo;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"taskCode\":\"")
                .append(taskCode).append('\"');
        sb.append(",\"version\":\"")
                .append(version).append('\"');
        sb.append(",\"tokenInfo\":\"")
                .append(tokenInfo).append('\"');
        sb.append(",\"taskTypeCode\":\"")
                .append(taskTypeCode).append('\"');
        sb.append(",\"data\":")
                .append(data);
        if(signInfo!=null && signInfo.getSignValue()!=null && !"".equals(signInfo.getSignValue())){
            sb.append(",\"signInfo\":")
                    .append(signInfo);
        }
        sb.append('}');
        return sb.toString();
    }
}
